<header />

<body class="boxed">

<div class="body">

    <!--header start-->
    <!--导航部分-->
    <include file="Common/header_nav" />
    <!--/导航部分-->


    <!-- /end header -->

    <div class="container">
        <div class="headerdivider"> </div>
        <div class="row-fluid">

            <div class="col-md-12  ">
                <div class="row">

                    <div class="col-md-6 col-xs-12">

                            <div class="titleborder">

                                <div>个人信息</div>

                            </div>

                        <a href="">
                            <img class="attachment-thumbnail" alt="" src="__PUBLIC__/asset/img/face.jpg">
                        </a>
                        姓名：{$userinfo.username}			<br>
                        性别：{$userinfo.sex}<br>
                        年龄：{$userinfo.age}<br>
                        属于部门： 	{$userinfo.class_str}		<br>

                        <small> 上次登陆时间：{$userinfo.lastdate}&nbsp;&nbsp;&nbsp;&nbsp;IP：{$userinfo.lastip}</small>
                        <br>

                        <a class="btn btn-primary " href="/TestHome/UserInfo/">编辑个人信息</a>

                    </div>

                    <div class="col-md-6 col-xs-12">
                        <div class="titleborder" >
                            <div>正在进行的问卷</div>
                        </div>

                        <div class="row">
                            <div class="col-md-1"><span id="quiz_notification" class="pull-right"></span></div>
                            <div class="col-md-11">
                                <div id="quiz_status_content">

                                    loading...
                                </div>
                            </div>
                        </div>


                        <!--<label>16pf人格测试  <a href="/Home/StartQuiz/doquiz">继续测试</a> </label>-->
                        <!--<small class="center-block">完成了10%</small>-->
                        <!--<label>wippf测试  <a href="/Home/StartQuiz/doquiz">继续测试</a> </label>-->
                        <!--<small class="center-block">完成了10%</small>-->

                    </div>


                </div>
            </div>


        </div>
    </div>

   <!--footer start-->
    <include file="Common/footer" />
    <!--footer end-->
</div>

</body>

</html>


<script>

    $(document).ready(function(){




        $.ajax({
            type:"GET",
            url:"/TestHome/Index/getQuizList",
            dataType:"json",
            async : false,
            success:function(data){

                var htmls = [];
                if(data.orgnizer == 0){
                    htmls.push('<label>普通用户测试</label>');
                }
                else if(data.orgnizer == 1){

                    $("#quiz_notification").html('<div class="badge badge-top bg-danger animated flash">'+Object.keys(data.detail).length+'</div>');

                    for (var i = 0; i < Object.keys(data.detail).length; i++){
                        htmls.push('<label>'+data.detail[i].quiz_title+' 由'+data.orgnizer_name+'发起 <a href="/TestHome/StartQuiz/doquiz?quiz_id='+data.detail[i].quiz_id+'">继续测试</a> </label>');
                        htmls.push('<small class="center-block">完成了'+data.detail[i].percent+'%</small>')
                    }
                }


                else{
                    htmls.push('<label>16pf人格测试  <a href="/Home/StartQuiz/doquiz">继续测试</a> </label>')
                    htmls.push('<small class="center-block">完成了'+data.pf16_percent+'%</small>')
                }

                $("#quiz_status_content").html(htmls.join(''));

            },error: function (jqXHR) {
                alert("failed"+jqXHR.status);
            }
        });
    });

</script>